<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml" xmlns:shiro="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="col-sm-12">
        <div class="ibox">
            <div class="ibox-body">
                <table id="exampleTable" data-mobile-responsive="true"  class="table table-hover table-striped">
                    <thead>
                    <tr>
                        <th style="width: 200px" data-field="id" tabindex="0">
                            <div class="th-inner ">定制类型</div>
                            <div class="fht-cell"></div>
                        </th>
                        <th style="width: 200px" data-field="name" tabindex="0">
                            <div class="th-inner ">金额</div>
                            <div class="fht-cell"></div>
                        </th>
                        <th style="width: 200px" data-field="id" tabindex="0">
                            <div class="th-inner ">操作</div>
                            <div class="fht-cell"></div>
                        </th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr data-index="0"  th:each="list:${list}">
                        <td th:text="${list.remark}"></td>
                        <td ><input type="number" oninput="if(value.length>6)value=value.slice(0,6)" th:id="'value' + ${list.code}" th:value="${list.value}"></td>
                        <td style=" " shiro:hasPermission="activity:custom:edit">
                            <a class="btn btn-primary btn-sm " href="#" title="保存"
                               mce_href="#"th:onclick="save([[${list.code}]])" ><i class="fa fa-edit"></i></a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<!--shiro控制bootstraptable行内按钮看见性 来自bootdo的创新方案 -->
<div>
    <script type="text/javascript">
        function save(code) {
            var value=$("#value"+code).val();
            $.ajax({
                url : "/activity/custom",
                type : "POST",
                data : {
                    'code' : code,
                    'value' :value
                },
                success : function(r) {
                    console.log(r)
                    if (r.resultCode == '000') {
                        layer.msg(r.resultDesc);
                        // reLoad();
                    } else {
                        layer.msg(r.resultDesc);
                    }
                }
            });
        }


    </script>
</div>

</div>
<div th:include="include :: footer"></div>
</body>
</html>